Add support to change request contents #16
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This pull request add support to change which requests are issued. It does this by allowing you to inject a different implementation of the (new) ICalDAVRequestFactory into the CalDAVRequestFactory, thereby adding support to change what goes into a specific request.
It also adds support to retrieve the full list of found properties of a request.
My use case is that I added a custom property to my calendars, and I want to request that property. However, I either do not understand the Facades or I might have missed how I can change the outgoing requests. Every class is final (which is a good thing), but there are no ways do to dependency injection either.
With this implementation I can now do the following:
and then in
Calendar\CalDAVRequestFactory
:This would then allow me to define my custom request in
App\Helpers\Calendar\Requests\GetCalendarsRequest
, and I can access my custom property as follows:I've toyed with the idea of having a DefaultCalDAVRequestFactory or an AbstractCalDAVRequestFactory so that I did not have to copy-paste the 'build' method and could just do
parent::build()
or$this->buildDefault()
or something, but they were all messy and I didn't find a clean / satisfactory solution.